using SqlSugar;
using IM.Easy.Core.Audit;

namespace IM.Easy.Entity.Msg
{
    /// <summary>
    /// 收件箱表
    /// </summary>
    [SugarTable("EmailRecives")]
    public class EmailRecives
    {
        /// <summary>
        /// 收件箱ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主键KEY")]
        public long Id { get; set; }

        /// <summary>
        /// 原始邮件ID
        /// </summary>
        [SugarColumn(ColumnName = "EmailId")]
        public long EmailId { get; set; }

        /// <summary>
        /// 受众用户ID
        /// </summary>
        [SugarColumn(ColumnName = "AudienceId")]
        public long AudienceId { get; set; }

        /// <summary>
        /// 接收时间
        /// </summary>
        [SugarColumn(ColumnName = "ReciveTime")]
        public DateTime ReciveTime { get; set; }

        /// <summary>
        /// 是否已读 (0: 未读, 1: 已读)
        /// </summary>
        [SugarColumn(ColumnName = "IsRead")]
        public bool IsRead { get; set; }

        /// <summary>
        /// 是否已删除
        /// </summary>
        [SugarColumn(ColumnName = "IsDeleted")]
        public bool IsDeleted { get; set; }

        /// <summary>
        /// 关联邮件信息
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(EmailId))]
        public Emails Email { get; set; }

        /// <summary>
        /// 发送方
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public EmailAccount Sender => Email?.Sender;
        /// <summary>
        /// 收件方
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(EmailId))]
        public EmailAccount Reciver { get; set; }

    }
}
